
package ProOF.apl.problems.real.operators;

import ProOF.apl.problems.real.RealCodification;
import ProOF.apl.problems.real.RealProblem;
import ProOF.com.LinkerParameters;
import ProOF.gen.operator.oMutation;

/**
 *
 * @author Hossomi
 */
public class RealMutDiv extends oMutation<RealProblem, RealCodification> {
    private double magnitude;
    
    @Override
    public String name() {
        return "Diverge";
    }

    @Override
    public void parameters(LinkerParameters win) throws Exception {
        magnitude = win.Dbl("Diverge magnitude", 0.05, 0, 1);
    }
    
    @Override
    public void mutation(RealProblem prob, RealCodification ind) throws Exception {
        for (int i = 0; i < prob.func.dimension(); i++) {
            ind.x[i] += magnitude * (prob.func.max(i) - ind.x[i]);
        }
        prob.func.adjust(ind.x);
    }

}
